import {API} from './config';
import CustomRequest from '@/utils/Request'

/* 
* 获取学校信息分页列表
*/
const pageList = async (params = {}) => {
  return await CustomRequest({
    api: API.budgetPage,
    method: 'post',
    params
  })
}

/* 
* 添加
*/
const add = async (params = {}) => {
  return await CustomRequest({
    api: API.budgetAdd,
    method: 'post',
    params
  })
}

/* 
* 删除
*/
const del = async (id) => {
  return await CustomRequest({
    api: API.budgetDel +`/${id}`
  })
}

/*
* 修改
*/
const update = async (params = {}) => {
  return await CustomRequest({
    api: API.budgetUpdate + `/${params.id}`,
    method: 'post',
    params
  })
}

/* 
* 详情
*/
const detail = async (id) => {
  return await CustomRequest({
    api: API.budgetDetail +`/${id}`
  })
}

/* 
* 获取预算包含的项目分页列表
*/
const pageItemList = async (params = {}) => {
  return await CustomRequest({
    api: API.budgetPageAllOrderItem,
    method: 'post',
    params
  })
}

/* 
* 获取预算列表
*/
const options = async (unitId) => {
  return await CustomRequest({
    api: API.budgetOption,
    params: {unitId}
  })
}



export {
  add,
  del,
  update,
  detail,
  options,
  pageList,
  pageItemList
  
}